#include "Alice/Timer/Timer.h"
#include "glad/glad.h"
#include "GLFW/glfw3.h"

namespace Alice
{

void Timer::Clock()
{
    m_current_time = glfwGetTime();
    if (m_is_first_tick)
    {
        m_start_time = m_current_time;
        m_is_first_tick = false;
    }
    m_delta_time = m_current_time - m_previous_time;
    m_previous_time = m_current_time;
}

void Timer::Reset()
{
    m_previous_time = 0;
}

double Timer::GetDeltaTime()
{
    return m_delta_time;
}

double Timer::GetTotalTime()
{
    return m_current_time - m_start_time;
}

double Timer::CurrentTime()
{
    return m_current_time;
}

} // namespace Alice
